package com.xzc.drools.ruleExe;

import com.xzc.drools.entity.ComparisonOperatorEntity;
import org.junit.Test;
import org.kie.api.KieServices;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;

import java.util.ArrayList;
import java.util.List;

public class C2 {

    @Test
    public void test3() {
        KieServices kieServices = KieServices.Factory.get();
        KieContainer kieClasspathContainer = kieServices.getKieClasspathContainer();
        KieSession kieSession = kieClasspathContainer.newKieSession();

        ComparisonOperatorEntity comparisonOperatorEntity = new ComparisonOperatorEntity();
        comparisonOperatorEntity.setNames("zhangsan");
        List<String> list = new ArrayList<String>();
        list.add("zhangsan");
        list.add("lisi");
        comparisonOperatorEntity.setList(list);

        kieSession.insert(comparisonOperatorEntity);
        kieSession.fireAllRules();
        kieSession.dispose();
    }
}
